<template>
    <ul class="right-list-container">
        <li v-for="(item, index) in list" :key="index">
            <span :class="{ active: item.isSelect }" @click="handleClick(item)">{{ item.name }}</span>
            <span :class="{ active: item.isSelect }" v-if="item.aside" class="aside" @click="handleClick(item)">{{ item.aside }}</span>
            <RightList :list="item.children" @select="handleClick" />
        </li>
    </ul>
</template>

<script>
export default {
    name: "RightList",
    props: {
        // [ { name:"xxx" }, isSelect:true, children:[ {name:"xxx",isSelect :true,} ] ]
        list: {
            type: Array,
            default: () => [],
        }
    },
    methods: {
        handleClick(item) {
            if (!item.isSelect) {
                this.$emit("select", item);
            }

        }
    }
}
</script>

<style scoped lang="less">
@import "~@/styles/var.less";

ul {
    list-style: none;
    padding: 0;

    .right-list-container {
        margin-left: 1em;
    }

    li {
        min-height: 40px;
        line-height: 40px;
        cursor: pointer;
        font-size: 14px;

        .active {
            color: @warn;

        }

    }

    .aside {
        margin-left: 10px;
        font-size: 1em;
        color:@gray ;
    }
}
</style>